import { defineStore } from 'pinia';
export default defineStore({
    id: 'aiStore',
    state: () => ({
        currUser: {},
        showStrategyListStrbottom: false,
        Authentication: uni.getStorageSync("Authentication") || '',
        beginDate: '',
        endDate: '',
		dayCount:'1',
		firstweek:'',
		lastweek:'',
        noteDetail: {}, // 笔记详情（攻略详情中的详情页面有用到）
        parentSpm: {}, // 来源页面信息
        // 初始化 globalData 对象，按照 globalDataType 类型定义赋值初始值
        globalData: {
            baseCdnUrl: '',
            statusBarHeight: 0,
            menuHeight: 0,
            tabHeight: 0,
            safeBottom: 0,
            navHeight: 0,
            navTop: 0,
            windowHeight: 0,
            imageHeight: '',
            os: '',
            common: {
            sever_time: '',
            client_time: '',
            utdid: '',
            brand: '',
            device_model: '',
            resolution: '',
            os: '',
            os_version: '',
            carrier: '',
            network_type: '',
            client_ip: '',
            source: '',
            source_name: '',
            version_code: '',
            sdk_version: '',
            user_id: '',
            user_nick: '',
            user_type: '',
            longitude: '',
            latitude: ''
            },
            menuRight: 0,
            appName: ''
        }
    }),
    getters: {
        getbeginDate(): string {
            return this.beginDate;
        },
        getendDate(): string {
            return this.endDate;
        },
        getGlobalDatae() {
            return this.setGlobalData;
        },
    },
    actions: {
        // 设置来源页面信息
        SET_PARENT_SPM(data) {
            this.parentSpm = data ;
        },
		SET_TOKEN(data) {
			this.Authentication = data;
		},
		SET_PAY_DATA(data) {
			this.payData = data;
		},
		SET_PAY_STATE(data){
			this.payState = data
		},
		SET_PAPERSTYPE(data){
			this.papersType = data
		},
		SET_lOGIN(data){
			this.isLoginIng = data
		},
		SET_SPM_DATA(data){
			console.log(data,'spmData')
			this.spmData = data;
		},
		SET_POINT_DATA(data){
			console.log(data,'pointData')
			this.pointData = data
		},
		SET_PRICE_DTOList(data){
			this.priceDTOList = data
		},
		SER_LIST_MEMBER(data){
			this.listMember = data
		},
		SET_LIST_MEMBER_PHONE(data){
			this.listMemberByPhone = data
		},
		SET_START_ADDRESS(data){
			this.startAddress = data 
		},
		SET_END_ADDRESS(data){
			this.endAddress = data
		},
		SET_Journey_Demand(data){
			this.journeyDemand = data
		},
		SET_StrategyList_Strbottom(data){
			this.showStrategyListStrbottom = data
		},
		SET_FORMDATA(data){
			this.formData = data
		},
		SET_FORMDATA_PUSH(data){
			console.log('执行了push')
			this.formData.push(data)
		},
		SET_HOTEL_SKU_DTO(data){
			this.hotelSkuDtoInfo = data
		},
        setGlobalData(newGlobalData) {
            this.setGlobalData = newGlobalData
        },
        setbeginDate(newDate?: string) {
			// console.log('0000',newDate);
            this.beginDate = newDate || '';
        },
        setendDate(newDate?: string) {
            this.endDate = newDate || '';
			// console.log('8888',newDate);
        },
        setdayCount(newDate?: string) {
            this.dayCount = newDate || '';
			// console.log('dayCount',newDate);
        },
        setfirstweek(newDate?: string) {
            this.firstweek = newDate || '';
			// console.log('firstweek',newDate);
        },
        setlastweek(newDate?: string) {
            this.lastweek = newDate || '';
			// console.log('lastweek',newDate);
        },
    },
});
